package com.polytech.diploma.SQLGenerator.Oracle.Conditions;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

public enum ConditionType {
	/**
	 * Comparison operators
	 */
	EQUALS(18),
	NOT_EQUALS(32),
	LESS_THAN(27),
	GREATER_THAN(21),
	LESS_OR_EQUALS(28),
	GREATER_OR_EQUALS(22),
	/**
	 * Logical operators
	 */
	IS_NULL(329),
	IS_NOT_NULL(326),
	LIKE(106),
	NOT_LIKE(403),
	BETWEEN(76),
	NOT_BETWEEN(400),
	IN(101),
	NOT_IN(402),
	EXISTS(92),
	NOT(107),
	AND(70),
	OR(112),
	ALL(68),
	ANY(71),
	SOME(534);
	
	private static final Map<Integer, ConditionType> lookup 
                = new HashMap<Integer,ConditionType>();

	static {
	     for(ConditionType type : EnumSet.allOf(ConditionType.class))
	          lookup.put(type.getValue(), type);
	}

	int value = 0;
	
	private ConditionType(int value)
	{
		this.value = value;
	}
	
	public int getValue() { return value; };
	
	public static ConditionType getConditionType(int value)
	{
		return lookup.get(value); 
	}
}
